import request from '@/utils/request'

// 提交答案
export function submitAnswer(data) {
  return request({
    url: '/userAnswer/submitAnswer',
    method: 'post',
    data
  })
}

// 获取用户答题历史
export function getUserAnswerHistory(userId) {
  return request({
    url: `/userAnswer/getUserAnswerHistory/${userId}`,
    method: 'get'
  })
}

// 获取用户答题统计
export function getUserStats(userId) {
  return request({
    url: `/userAnswer/getUserStats/${userId}`,
    method: 'get'
  })
}

// 获取题目统计
export function getQuestionStats(questionId) {
  return request({
    url: `/userAnswer/getQuestionStats/${questionId}`,
    method: 'get'
  })
}

// 分页获取用户答题历史
export function getUserAnswerHistoryPage(params) {
  return request({
    url: '/userAnswer/getUserAnswerHistoryPage',
    method: 'post',
    data: params
  })
}

export default {
  submitAnswer,
  getUserAnswerHistory,
  getUserStats,
  getQuestionStats,
  getUserAnswerHistoryPage
}
